<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    // 随机发送4位验证码

    var str = '1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM';

    function sj(min, max) {
        return Math.floor(Math.random() * (max - min + 1)) + min
    }

    var yzm = '';

    // 3秒以后调用
    setTimeout(function() {
        // 循环6次
        for (var i = 1; i <= 6; i++) {
            // 随机一个字符
            var a = str[sj(0, str.length - 1)];
            // 字符串拼接
            yzm += a;
        }
        alert(yzm)
    }, 3000)
</script>